package br.ufrj.dcc.tp.servidor.controller;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import br.ufrj.dcc.tp.servidor.gui.Window;

public class TextAreaKeyListener extends KeyAdapter {
	
	private Window w;
	
	public TextAreaKeyListener(Window w) {
		this.w = w;
	}
	
	@Override
	public void keyTyped(KeyEvent e) {
		if( e.getKeyChar() == KeyEvent.VK_ENTER &&
			e.getModifiersEx() == KeyEvent.CTRL_DOWN_MASK ) {
			
			w.delegateSendMessage();
			e.consume();
		}
	}
}
